import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/seal_detail_entity.dart';
import 'package:seedfour/app/models/case_list_entity.dart';


SealDetailEntity $SealDetailEntityFromJson(Map<String, dynamic> json) {
  final SealDetailEntity sealDetailEntity = SealDetailEntity();
  final SealDetailCommonApply? commonApply = jsonConvert.convert<
      SealDetailCommonApply>(json['commonApply']);
  if (commonApply != null) {
    sealDetailEntity.commonApply = commonApply;
  }
  final List<SealApproveRecord>? approveList = (json['approveList'] as List<
      dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<SealApproveRecord>(e) as SealApproveRecord)
      .toList();
  if (approveList != null) {
    sealDetailEntity.approveList = approveList;
  }
  final List<SealAttachFile>? attachFiles = (json['attachFiles'] as List<
      dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<SealAttachFile>(e) as SealAttachFile)
      .toList();
  if (attachFiles != null) {
    sealDetailEntity.attachFiles = attachFiles;
  }
  final CaseInfo? caseInfo = jsonConvert.convert<CaseInfo>(json['caseInfo']);
  if (caseInfo != null) {
    sealDetailEntity.caseInfo = caseInfo;
  }
  return sealDetailEntity;
}

Map<String, dynamic> $SealDetailEntityToJson(SealDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['commonApply'] = entity.commonApply?.toJson();
  data['approveList'] = entity.approveList?.map((v) => v.toJson()).toList();
  data['attachFiles'] = entity.attachFiles?.map((v) => v.toJson()).toList();
  data['caseInfo'] = entity.caseInfo?.toJson();
  return data;
}

extension SealDetailEntityExtension on SealDetailEntity {
  SealDetailEntity copyWith({
    SealDetailCommonApply? commonApply,
    List<SealApproveRecord>? approveList,
    List<SealAttachFile>? attachFiles,
    CaseInfo? caseInfo,
  }) {
    return SealDetailEntity()
      ..commonApply = commonApply ?? this.commonApply
      ..approveList = approveList ?? this.approveList
      ..attachFiles = attachFiles ?? this.attachFiles
      ..caseInfo = caseInfo ?? this.caseInfo;
  }
}

SealDetailCommonApply $SealDetailCommonApplyFromJson(
    Map<String, dynamic> json) {
  final SealDetailCommonApply sealDetailCommonApply = SealDetailCommonApply();
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    sealDetailCommonApply.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    sealDetailCommonApply.updatedAt = updatedAt;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    sealDetailCommonApply.id = id;
  }
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    sealDetailCommonApply.uid = uid;
  }
  final String? orgId = jsonConvert.convert<String>(json['orgId']);
  if (orgId != null) {
    sealDetailCommonApply.orgId = orgId;
  }
  final String? caseId = jsonConvert.convert<String>(json['caseId']);
  if (caseId != null) {
    sealDetailCommonApply.caseId = caseId;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    sealDetailCommonApply.type = type;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    sealDetailCommonApply.status = status;
  }
  final int? sealType = jsonConvert.convert<int>(json['sealType']);
  if (sealType != null) {
    sealDetailCommonApply.sealType = sealType;
  }
  final int? printNum = jsonConvert.convert<int>(json['printNum']);
  if (printNum != null) {
    sealDetailCommonApply.printNum = printNum;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    sealDetailCommonApply.remark = remark;
  }
  final String? taker = jsonConvert.convert<String>(json['taker']);
  if (taker != null) {
    sealDetailCommonApply.taker = taker;
  }
  final String? rejectRemark = jsonConvert.convert<String>(
      json['rejectRemark']);
  if (rejectRemark != null) {
    sealDetailCommonApply.rejectRemark = rejectRemark;
  }
  final String? completeRemark = jsonConvert.convert<String>(
      json['completeRemark']);
  if (completeRemark != null) {
    sealDetailCommonApply.completeRemark = completeRemark;
  }
  final String? creatorName = jsonConvert.convert<String>(json['creatorName']);
  if (creatorName != null) {
    sealDetailCommonApply.creatorName = creatorName;
  }
  final bool? isOwner = jsonConvert.convert<bool>(json['isOwner']);
  if (isOwner != null) {
    sealDetailCommonApply.isOwner = isOwner;
  }
  return sealDetailCommonApply;
}

Map<String, dynamic> $SealDetailCommonApplyToJson(
    SealDetailCommonApply entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['id'] = entity.id;
  data['uid'] = entity.uid;
  data['orgId'] = entity.orgId;
  data['caseId'] = entity.caseId;
  data['type'] = entity.type;
  data['status'] = entity.status;
  data['sealType'] = entity.sealType;
  data['printNum'] = entity.printNum;
  data['remark'] = entity.remark;
  data['taker'] = entity.taker;
  data['rejectRemark'] = entity.rejectRemark;
  data['completeRemark'] = entity.completeRemark;
  data['creatorName'] = entity.creatorName;
  data['isOwner'] = entity.isOwner;
  return data;
}

extension SealDetailCommonApplyExtension on SealDetailCommonApply {
  SealDetailCommonApply copyWith({
    int? createdAt,
    int? updatedAt,
    String? id,
    String? uid,
    String? orgId,
    String? caseId,
    int? type,
    int? status,
    int? sealType,
    int? printNum,
    String? remark,
    String? taker,
    String? rejectRemark,
    String? completeRemark,
    String? creatorName,
    bool? isOwner,
  }) {
    return SealDetailCommonApply()
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..id = id ?? this.id
      ..uid = uid ?? this.uid
      ..orgId = orgId ?? this.orgId
      ..caseId = caseId ?? this.caseId
      ..type = type ?? this.type
      ..status = status ?? this.status
      ..sealType = sealType ?? this.sealType
      ..printNum = printNum ?? this.printNum
      ..remark = remark ?? this.remark
      ..taker = taker ?? this.taker
      ..rejectRemark = rejectRemark ?? this.rejectRemark
      ..completeRemark = completeRemark ?? this.completeRemark
      ..creatorName = creatorName ?? this.creatorName
      ..isOwner = isOwner ?? this.isOwner;
  }
}

SealApproveRecord $SealApproveRecordFromJson(Map<String, dynamic> json) {
  final SealApproveRecord sealApproveRecord = SealApproveRecord();
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    sealApproveRecord.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    sealApproveRecord.updatedAt = updatedAt;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    sealApproveRecord.id = id;
  }
  final String? caseId = jsonConvert.convert<String>(json['caseId']);
  if (caseId != null) {
    sealApproveRecord.caseId = caseId;
  }
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    sealApproveRecord.uid = uid;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    sealApproveRecord.type = type;
  }
  final int? approve = jsonConvert.convert<int>(json['approve']);
  if (approve != null) {
    sealApproveRecord.approve = approve;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    sealApproveRecord.remark = remark;
  }
  final String? approverName = jsonConvert.convert<String>(
      json['approverName']);
  if (approverName != null) {
    sealApproveRecord.approverName = approverName;
  }
  return sealApproveRecord;
}

Map<String, dynamic> $SealApproveRecordToJson(SealApproveRecord entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['id'] = entity.id;
  data['caseId'] = entity.caseId;
  data['uid'] = entity.uid;
  data['type'] = entity.type;
  data['approve'] = entity.approve;
  data['remark'] = entity.remark;
  data['approverName'] = entity.approverName;
  return data;
}

extension SealApproveRecordExtension on SealApproveRecord {
  SealApproveRecord copyWith({
    int? createdAt,
    int? updatedAt,
    int? id,
    String? caseId,
    String? uid,
    int? type,
    int? approve,
    String? remark,
    String? approverName,
  }) {
    return SealApproveRecord()
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..id = id ?? this.id
      ..caseId = caseId ?? this.caseId
      ..uid = uid ?? this.uid
      ..type = type ?? this.type
      ..approve = approve ?? this.approve
      ..remark = remark ?? this.remark
      ..approverName = approverName ?? this.approverName;
  }
}

SealAttachFile $SealAttachFileFromJson(Map<String, dynamic> json) {
  final SealAttachFile sealAttachFile = SealAttachFile();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    sealAttachFile.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    sealAttachFile.name = name;
  }
  final String? dname = jsonConvert.convert<String>(json['dname']);
  if (dname != null) {
    sealAttachFile.dname = dname;
  }
  return sealAttachFile;
}

Map<String, dynamic> $SealAttachFileToJson(SealAttachFile entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['dname'] = entity.dname;
  return data;
}

extension SealAttachFileExtension on SealAttachFile {
  SealAttachFile copyWith({
    int? id,
    String? name,
    String? dname,
  }) {
    return SealAttachFile()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..dname = dname ?? this.dname;
  }
}